<?php
namespace app\common\model;

use think\Model;

/**
 * 公共的model层
 * Class BaseModel
 * @package app\common\model
 */
class BaseModel extends Model
{
    protected $autoWriteTimestamp = true;

    public function add($data)
    {
        // 默认状态值0
        $data['status'] = 0;
        $this->save($data);
        return $this->id;
    }

    public function updateById($data, $id)
    {
        return $this->allowField(true)->save($data, ['id' => $id]);
    }
}